package frame.base;

/**
 * 支持前端BootstrapTable控件查询对象
 * @author PeiWentao
 */
public class BootStrapQo extends BaseQo {

    /** 排序字段*/
    private String sort;
    /** 排序规则 ASC DESC*/
    private String order;
    /** 第xx条 */
    private int offset = 0;
    /** 每页xx条*/
    private int limit = 10;

    @Override
    public int page() {
        return offset/limit + 1;
    }

    @Override
    public int size() {
        return limit;
    }

    @Override
    public String getOrderStr() {
        if (sort != null && !"".equals(sort.trim()) && order != null && !"".equals(order.trim()) )
            return sort + " " + order;
        else
            return super.getOrderStr();
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }


}
